//
//  FeedbackViewController.m
//  FKGW
//
//  Created by song ce on 2017/2/28.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "FeedbackViewController.h"

@interface FeedbackViewController ()<UITextViewDelegate>

@property (weak, nonatomic) IBOutlet UILabel *placeHoderLabel;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
@property (weak, nonatomic) IBOutlet UITextView *textV;

@property(nonatomic,copy)NSString *str;

@end

@implementation FeedbackViewController

- (void)viewDidLoad {
    if(!ISNOTNEEDMESSAGEBTN){
        self.isNeedMessageItem = YES;
    }

    [super viewDidLoad];
    self.vcName = @"意见反馈";
    self.textV.delegate = self;
  }
- (IBAction)commit:(id)sender {
    if(!self.textV.text.length){
        [MBProgressHUD showTipMessageInWindow:@"请输入您的宝贵意见后再提交"];
        return;
    }
    [MBProgressHUD showActivityMessageInWindow:@""];
    [self performSelector:@selector(oklehaha) withObject:nil afterDelay:2];
}
-(void)oklehaha{
      [MBProgressHUD dismiss];
      [MBProgressHUD showTipMessageInWindow:@"提交成功，感谢您提供的宝贵意见"];

}

#pragma mark - UITextFiledDelegate
- (void)textViewDidChange:(UITextView *)textView;{
    if(self.textV.text.length>200){
        self.textV.text= self.str;
        return;
    }
    NSInteger count = textView.text.length;
    self.str = textView.text;
    if(count>0){
        self.countLabel.text = [NSString stringWithFormat:@"%ld/200",count];
    }else{
        self.countLabel.text = @"0/200";
    }
    
    if([self.textV.text isEqualToString:@""]){
        self.placeHoderLabel.hidden=NO;
    }else{
        self.placeHoderLabel.hidden=YES;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
